#coding=utf-8

class BaseRowGenerator(object):
    def __init__(self, row_value):
        self.row_value = row_value
        self.inited_row_value = self.init_row_value(self.row_value)
        self.collect_useful_data()

    #子类实现此方法
    def collect_useful_data(self):
        pass

    #先对row_value 进行一些简单的处理，将为空的数据设置为None, 将unicode编码转化为 utf-8 编码
    def init_row_value(self,row_value):
        new_data = []
        for value in row_value:
            if type(value) != unicode:
                value = str(value)
            else:
                value = value.encode('utf-8')

            if value == '':
                value = None

            if type(value) == str:
                value = value.strip()
            new_data.append(value)
        return new_data
